package com.eastfair.venueservice.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import com.eastfair.database.mybatis.typehandler.M9EncryptHandler;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;
import com.eastfair.venueservice.enumeration.ServiceProviderAuditStatusEnum;
import com.eastfair.venueservice.enumeration.ServiceProviderCompanyTypeEnum;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 服务商信息表
 * </p>
 *
 * @author lyw
 * @since 2023-02-07
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName(value="vsm_service_provider",autoResultMap = true)
@ApiModel(value = "ServiceProvider", description = "服务商信息表")
@AllArgsConstructor
public class ServiceProvider extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 是否启用（确认状态）：1是 已确认；0否 未确认
     */
    @ApiModelProperty(value = "是否启用（确认状态）：1是 已确认；0否 未确认")
    @TableField(value = "is_enabled")
    @Excel(name = "是否启用（确认状态）：1是 已确认；0否 未确认")
    private Integer isEnabled;

    /**
     * 是否删除：1是；0否
     */
    @ApiModelProperty(value = "是否删除：1是；0否")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除：1是；0否")
    private Integer isDeleted;

    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    @TableField(value = "project_id")
    @Excel(name = "项目id")
    private Long projectId;

    /**
     * 子系统id
     */
    @ApiModelProperty(value = "子系统id")
    @TableField(value = "subsystem_id")
    @Excel(name = "子系统id")
    private Long subsystemId;

    /**
     * 租户id
     */
    @ApiModelProperty(value = "租户id")
    @TableField(value = "tenant_id")
    @Excel(name = "租户id")
    private Long tenantId;

    /**
     * 企业编码
     */
    @ApiModelProperty(value = "企业编码")
    @Size(max = 64, message = "企业编码长度不能超过64")
    @TableField(value = "company_code", condition = LIKE)
    @Excel(name = "企业编码")
    private String companyCode;

    /**
     * (字段弃用，用户服务商关系在vsm_service_provider_user表中)用户ID
     */
    @ApiModelProperty(value = "(字段弃用，用户服务商关系在vsm_service_provider_user表中)用户ID")
    @TableField(value = "user_id")
    @Excel(name = "(字段弃用，用户服务商关系在vsm_service_provider_user表中)用户ID")
    private Long userId;

    /**
     * 公司名称
     */
    @ApiModelProperty(value = "公司名称")
    @Size(max = 255, message = "公司名称长度不能超过255")
    @TableField(value = "company_name", condition = LIKE)
    @Excel(name = "公司名称")
    private String companyName;

    /**
     * 公司地址
     */
    @ApiModelProperty(value = "公司地址")
    @Size(max = 255, message = "公司地址长度不能超过255")
    @TableField(value = "company_address", condition = LIKE)
    @Excel(name = "公司地址")
    private String companyAddress;

    /**
     * 统一社会信用代码
     */
    @ApiModelProperty(value = "统一社会信用代码")
    @Size(max = 64, message = "统一社会信用代码长度不能超过64")
    @TableField(value = "uscc", condition = LIKE)
    @Excel(name = "统一社会信用代码")
    private String uscc;

    /**
     * 公司电话
     */
    @ApiModelProperty(value = "公司电话")
    @Size(max = 64, message = "公司电话长度不能超过64")
    @TableField(value = "company_phone", condition = LIKE)
    @Excel(name = "公司电话")
    private String companyPhone;

    /**
     * 负责人姓名
     */
    @ApiModelProperty(value = "负责人姓名")
    @Size(max = 64, message = "负责人姓名长度不能超过64")
    @TableField(value = "principal_name", condition = LIKE)
    @Excel(name = "负责人姓名")
    private String principalName;

    /**
     * 负责人手机号
     */
    @ApiModelProperty(value = "负责人手机号")
    @Size(max = 64, message = "负责人手机号长度不能超过64")
    @TableField(value = "principal_mobile", condition = LIKE,typeHandler = M9EncryptHandler.class )
    @Excel(name = "负责人手机号")
    private String principalMobile;

    /**
     * 负责人电话
     */
    @ApiModelProperty(value = "负责人电话")
    @Size(max = 64, message = "负责人电话长度不能超过64")
    @TableField(value = "principal_phone", condition = LIKE)
    @Excel(name = "负责人电话")
    private String principalPhone;

    /**
     * 邮箱
     */
    @ApiModelProperty(value = "邮箱")
    @Size(max = 64, message = "邮箱长度不能超过64")
    @TableField(value = "principal_email", condition = LIKE)
    @Excel(name = "邮箱")
    private String principalEmail;

    /**
     * 负责人身份证国徽面
     */
    @ApiModelProperty(value = "负责人身份证国徽面")
    @Size(max = 255, message = "负责人身份证国徽面长度不能超过255")
    @TableField(value = "principal_idcard_front", condition = LIKE)
    @Excel(name = "负责人身份证国徽面")
    private String principalIdcardFront;

    /**
     * 负责人身份证人像面
     */
    @ApiModelProperty(value = "负责人身份证人像面")
    @Size(max = 255, message = "负责人身份证人像面长度不能超过255")
    @TableField(value = "principal_idcard_back", condition = LIKE)
    @Excel(name = "负责人身份证人像面")
    private String principalIdcardBack;

    /**
     * 法人姓名
     */
    @ApiModelProperty(value = "法人姓名")
    @Size(max = 64, message = "法人姓名长度不能超过64")
    @TableField(value = "legal_name", condition = LIKE)
    @Excel(name = "法人姓名")
    private String legalName;

    /**
     * 法人手机号
     */
    @ApiModelProperty(value = "法人手机号")
    @Size(max = 64, message = "法人手机号长度不能超过64")
    @TableField(value = "legal_mobile", condition = LIKE,typeHandler = M9EncryptHandler.class)
    @Excel(name = "法人手机号")
    private String legalMobile;

    /**
     * 法人身份证国徽面
     */
    @ApiModelProperty(value = "法人身份证国徽面")
    @Size(max = 255, message = "法人身份证国徽面长度不能超过255")
    @TableField(value = "legal_idcard_front", condition = LIKE)
    @Excel(name = "法人身份证国徽面")
    private String legalIdcardFront;

    /**
     * 法人身份证人像面
     */
    @ApiModelProperty(value = "法人身份证人像面")
    @Size(max = 255, message = "法人身份证人像面长度不能超过255")
    @TableField(value = "legal_idcard_back", condition = LIKE)
    @Excel(name = "法人身份证人像面")
    private String legalIdcardBack;

    /**
     * 营业执照
     */
    @ApiModelProperty(value = "营业执照")
    @Size(max = 255, message = "营业执照长度不能超过255")
    @TableField(value = "company_license", condition = LIKE)
    @Excel(name = "营业执照")
    private String companyLicense;

    /**
     * 发票邮寄地址
     */
    @ApiModelProperty(value = "发票邮寄地址")
    @Size(max = 255, message = "发票邮寄地址长度不能超过255")
    @TableField(value = "invoice_mail_address", condition = LIKE)
    @Excel(name = "发票邮寄地址")
    private String invoiceMailAddress;

    /**
     * 企业类别 #{GENERAL_TAXPAYER:一般纳税人;SMALL_TAXPAYER:小规模纳税人}
     */
    @ApiModelProperty(value = "企业类别 #{GENERAL_TAXPAYER:一般纳税人;SMALL_TAXPAYER:小规模纳税人}")
    @TableField(value = "company_type")
    @Excel(name = "企业类别 #{GENERAL_TAXPAYER:一般纳税人;SMALL_TAXPAYER:小规模纳税人}", replace = {"一般纳税人_GENERAL_TAXPAYER", "小规模纳税人_SMALL_TAXPAYER",  "_null"})
    private ServiceProviderCompanyTypeEnum companyType;

    /**
     * 开户银行名称
     */
    @ApiModelProperty(value = "开户银行名称")
    @Size(max = 255, message = "开户银行名称长度不能超过255")
    @TableField(value = "bank_name", condition = LIKE)
    @Excel(name = "开户银行名称")
    private String bankName;

    /**
     * 开户银行账号
     */
    @ApiModelProperty(value = "开户银行账号")
    @Size(max = 64, message = "开户银行账号长度不能超过64")
    @TableField(value = "bank_account", condition = LIKE)
    @Excel(name = "开户银行账号")
    private String bankAccount;

    /**
     * 当前审核状态 #{REPORTING:申报中;APPROVED:合格;NOT_APPROVED:不合格}
     */
    @ApiModelProperty(value = "当前审核状态 #{REPORTING:申报中;APPROVED:合格;NOT_APPROVED:不合格}")
    @TableField(value = "audit_status")
    @Excel(name = "当前审核状态 #{REPORTING:申报中;APPROVED:合格;NOT_APPROVED:不合格}", replace = {"申报中_REPORTING", "合格_APPROVED", "不合格_NOT_APPROVED",  "_null"})
    private ServiceProviderAuditStatusEnum auditStatus;

    /**
     * 主体类型(主场，配套服务商，搭建商 etc)
     */
    @ApiModelProperty(value = "主体类型(主场，配套服务商，搭建商 etc)")
    @Size(max = 64, message = "主体类型(主场，配套服务商，搭建商 etc)长度不能超过64")
    @TableField(value = "service_provider_type", condition = LIKE)
    @Excel(name = "主体类型(主场，配套服务商，搭建商 etc)")
    private String serviceProviderType;

    /**
     * 有效期开始时间
     */
    @ApiModelProperty(value = "有效期开始时间")
    @TableField(value = "valid_start_time")
    @Excel(name = "有效期开始时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime validStartTime;

    /**
     * 有效期结束时间
     */
    @ApiModelProperty(value = "有效期结束时间")
    @TableField(value = "valid_end_time")
    @Excel(name = "有效期结束时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime validEndTime;

    /**
     * 注册时间
     */
    @ApiModelProperty(value = "注册时间")
    @TableField(value = "register_time")
    @Excel(name = "注册时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime registerTime;

    /**
     * (弃用)是否是用户首次注册的服务商(0:否;1:是)
     */
    @ApiModelProperty(value = "(弃用)是否是用户首次注册的服务商(0:否;1:是)")
    @TableField(value = "is_user_first_register")
    @Excel(name = "(弃用)是否是用户首次注册的服务商(0:否;1:是)")
    private Integer isUserFirstRegister;

    /**
     * 备注
     */
    @ApiModelProperty(value = "备注")
    @Size(max = 255, message = "备注长度不能超过255")
    @TableField(value = "remark", condition = LIKE)
    @Excel(name = "备注")
    private String remark;

    /**
     * cms同步状态 0:未同步; 1:已同步
     */
    @ApiModelProperty(value = "cms同步状态 0:未同步; 1:已同步")
    @NotNull(message = "请填写cms同步状态 0:未同步; 1:已同步")
    @TableField(value = "cms_sync")
    @Excel(name = "cms同步状态 0:未同步; 1:已同步")
    private Integer cmsSync;

    /**
     * 信誉分值
     */
    @ApiModelProperty(value = "信誉分值")
    @TableField(value = "credit_score")
    @Excel(name = "信誉分值")
    private Integer creditScore;


    @Builder
    public ServiceProvider(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, 
                    Integer isEnabled, Integer isDeleted, Long projectId, Long subsystemId, Long tenantId, 
                    String companyCode, Long userId, String companyName, String companyAddress, String uscc, String companyPhone, 
                    String principalName, String principalMobile, String principalPhone, String principalEmail, String principalIdcardFront, String principalIdcardBack, 
                    String legalName, String legalMobile, String legalIdcardFront, String legalIdcardBack, String companyLicense, String invoiceMailAddress, 
                    ServiceProviderCompanyTypeEnum companyType, String bankName, String bankAccount, ServiceProviderAuditStatusEnum auditStatus, String serviceProviderType, LocalDateTime validStartTime, 
                    LocalDateTime validEndTime, LocalDateTime registerTime, Integer isUserFirstRegister, String remark, Integer cmsSync, Integer creditScore) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
        this.projectId = projectId;
        this.subsystemId = subsystemId;
        this.tenantId = tenantId;
        this.companyCode = companyCode;
        this.userId = userId;
        this.companyName = companyName;
        this.companyAddress = companyAddress;
        this.uscc = uscc;
        this.companyPhone = companyPhone;
        this.principalName = principalName;
        this.principalMobile = principalMobile;
        this.principalPhone = principalPhone;
        this.principalEmail = principalEmail;
        this.principalIdcardFront = principalIdcardFront;
        this.principalIdcardBack = principalIdcardBack;
        this.legalName = legalName;
        this.legalMobile = legalMobile;
        this.legalIdcardFront = legalIdcardFront;
        this.legalIdcardBack = legalIdcardBack;
        this.companyLicense = companyLicense;
        this.invoiceMailAddress = invoiceMailAddress;
        this.companyType = companyType;
        this.bankName = bankName;
        this.bankAccount = bankAccount;
        this.auditStatus = auditStatus;
        this.serviceProviderType = serviceProviderType;
        this.validStartTime = validStartTime;
        this.validEndTime = validEndTime;
        this.registerTime = registerTime;
        this.isUserFirstRegister = isUserFirstRegister;
        this.remark = remark;
        this.cmsSync = cmsSync;
        this.creditScore = creditScore;
    }

}
